package team.soi.cloud.order.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import team.soi.cloud.order.model.Order;
import team.soi.cloud.order.service.GoodsService;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

/**
 * 功能描述: <br/>
 *
 * @author Soi <br/>
 * @version 1.0 2016/8/11 10:47
 * @see
 */
@RestController
@RequestMapping("/order")
public class OderController {

    @Autowired
    private GoodsService goodsService;

    @RequestMapping(value = "/", method = RequestMethod.GET)
    public List<?> list() {
        List<Order> list = new ArrayList<Order>();
        List<?> goods = goodsService.list();
        Order order = new Order();
        order.setId(UUID.randomUUID().toString());
        order.setGoods(goods);
        list.add(order);
        return list;
    }
}
